// const makeSound = (animal) => {
//     if (animal instanceof Duck) {
//         console.log('嘎嘎嘎嘎');
//     } else if (animal instanceof Chicken) {
//         console.log('落落落');
//     }
// }

// const Duck = function() {}
// const Chicken = function() {}

// makeSound(new Duck());
// makeSound( new Chicken())


const makeSound = (animal) => {
    animal.sound();
}

const Duck = function() {};
Duck.prototype.sound = () => {
    console.log('嘎嘎嘎嘎');
}

const Chicken = function() {}
Chicken.prototype.sound = () => {
    console.log('咯咯咯');
}

const Dog = function() {};
Dog.prototype.sound = () => {
    console.log('汪汪汪');
}

makeSound(new Duck());
makeSound(new Chicken());



const googleMap = {
    show: () => {
        console.log('google map');
    }
}

const amap = {
    show: () => {
        console.log('amap');
    }
}

const renderMap = (map) => {
    if (map.show instanceof Function) {
        map.show();
    }
}

renderMap(googleMap);
renderMap(amap)